#!/usr/bin/env bash

############################################################################
#
# 远程执行该脚本，请在命令行中直接执行以下命令：
#
#   curl -sSL https://gitee.com/tay3223/biubiubiu/raw/master/centos7-install-python379-build.sh | /bin/bash
#
#
############################################################################

if (ls /usr/local | grep python37); then
    echo "python379已经存在，不再重复安装~~~"
else
    yum groupinstall -y "Development tools"
    yum install -y zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gcc make libffi-devel
    mkdir -p /tmp/bao/
    wget -c -P /tmp/bao/ https://osoc.oss-cn-shanghai.aliyuncs.com/bao/python/Python-3.7.9.tar.xz
    tar Jxvf /tmp/bao/Python-3.7.9.tar.xz -C /tmp/bao/
    cd /tmp/bao/Python-3.7.9/ || exit
    ./configure prefix=/usr/local/python379
    make && make install
    ln -fs /usr/local/python379/bin/python3 /usr/local/bin/python3
    ln -fs /usr/local/python379/bin/pip3 /usr/local/bin/pip3
fi

cat <<lalala

===================================================
python3安装成功！！！

文件解压在/usr/local/python379目录下

相关命令已经软连接到/usr/local/bin/目录下
===================================================

lalala
